#include "processBar.h"
#include <unistd.h>
#include <string.h>

#define NUM 102

char bar[NUM];
const char* lable = "|/-\\";

void initBar()
{
	memset(bar, 0, sizeof(bar));
}


void processBar()
{
	int len = strlen(lable);
	int cnt = 0;
	while (cnt <= 100)
	{
		printf("[%-100s][%-3d%%][%c]\r", bar, cnt, lable[cnt%len]);
		fflush(stdout);
		bar[cnt++] = '=';
		if (cnt < 100) bar[cnt] = '>';
		usleep(50000);
	}
	printf("\n");
}
